import request from '@/utils/request'

// 查询派单列表
export function listDispatch(query) {
  return request({
    url: '/product/dispatch/list',
    method: 'get',
    params: query
  })
}

// 查询派单详细
export function getDispatch(id) {
  return request({
    url: '/product/dispatch/' + id,
    method: 'get'
  })
}

// 新增派单
export function addDispatch(data) {
  return request({
    url: '/product/dispatch',
    method: 'post',
    data: data
  })
}

// 修改派单
export function updateDispatch(data) {
  return request({
    url: '/product/dispatch',
    method: 'put',
    data: data
  })
}

// 删除派单
export function delDispatch(id) {
  return request({
    url: '/product/dispatch/' + id,
    method: 'delete'
  })
}

// 根据指令ID查询派单
export function getDispatchByOrderCode(orderCode) {
  return request({
    url: `/product/dispatch/selectByOrderCode/${orderCode}`,
    method: 'get'
  })
}
